home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / BoxPaint / Source / Window.cpp < prev    next >
Text File  |  1997-02-20  |  3KB  |  124 lines

  1. /*
  2.  *  File:       Window.cpp
  3.  *  Summary:       A window into the document's data.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <->     5/26/96    JDJ        Created
  12.  */
  13.  
  14. #include "Window.h"
  15.  
  16. #include <ZEvent.h>
  17. #include <ZStream.h>
  18.  
  19. #include "Doc.h"
  20. #include "Pane.h"
  21.  
  22.  
  23. //-----------------------------------
  24. //    Constants
  25. //
  26. const short kSavedVersion = 0;                    // Version number of the saved data
  27.  
  28.  
  29. // ===================================================================================
  30. //    class CWindow
  31. // ===================================================================================
  32.  
  33. // Registers CWindow::Create with the reanimator so that the window
  34. // can be reanimated from a 'Wind' resource. Note that the "Dead
  35. // Strip Static Initialization Code" linker preference should be off.
  36. static TReanimatorRegister<CWindow> sMyWindowRegistrar;
  37.  
  38. //---------------------------------------------------------------
  39. //
  40. // CWindow::~CWindow
  41. //
  42. //---------------------------------------------------------------
  43. CWindow::~CWindow()
  44. {
  45. }
  46.  
  47.  
  48. //---------------------------------------------------------------
  49. //
  50. // CWindow::CWindow 
  51. //
  52. //---------------------------------------------------------------
  53. CWindow::CWindow()
  54. {
  55. }
  56.  
  57.  
  58. //---------------------------------------------------------------
  59. //
  60. // CWindow::OnReanimated 
  61. //
  62. //---------------------------------------------------------------
  63. void CWindow::OnReanimated()
  64. {    
  65.     Inherited::OnReanimated();
  66.     
  67.     CPane* pane = dynamic_cast<CPane*>(this->FindSubPane("3D Pane"));
  68.     ASSERT(pane != nil);
  69.     
  70.     this->SetLatentTarget(pane);
  71. }
  72.  
  73.  
  74. //---------------------------------------------------------------
  75. //
  76. // CWindow::Create                                        [static]
  77. //
  78. //---------------------------------------------------------------
  79. MReanimatable* CWindow::Create(MReanimatable* parent)
  80. {
  81.     // When creating views parent is the superView. When creating
  82.     // windows parent should be nil. (TWindow::Create takes care
  83.     // of setting the window's superCommander).
  84.     ASSERT(parent == nil);
  85.     
  86.     return new CWindow;
  87. }
  88.  
  89. #pragma mark ハ
  90.  
  91. //---------------------------------------------------------------
  92. //
  93. // CWindow::OnMenuCommand
  94. //
  95. //---------------------------------------------------------------
  96. bool CWindow::OnMenuCommand(const MenuCommand& command)
  97. {
  98.     bool handled = false;
  99.     
  100.     if (!handled)
  101.         handled = Inherited::OnMenuCommand(command);
  102.     
  103.     return handled;
  104. }
  105.  
  106.  
  107. //---------------------------------------------------------------
  108. //
  109. // CWindow::OnCommandStatus
  110. //
  111. //---------------------------------------------------------------
  112. bool CWindow::OnCommandStatus(const MenuCommand& command, SCommandStatus& status)
  113. {
  114.     bool handled = false;
  115.     
  116.     if (!handled)
  117.         handled = Inherited::OnCommandStatus(command, status);
  118.     
  119.     return handled;
  120. }
  121.  
  122.  
  123.  
  124.